package com.wuchao.annotation;

import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;

/**
 * @Author wuchao66
 * @Date 2023/10/31 11:02
 * @PackageName:com.wuchao.annotation
 * @ClassName: TTT
 * @Description: TODO
 * @Param
 * @Version 1.0
 */
public class TTT {
    public static void main(String[] args) throws IllegalAccessException, InstantiationException {

        Class<TT> ttClass = TT.class;
        TT tt = ttClass.newInstance();

        Arrays.stream(ttClass.getDeclaredMethods())
                .forEach(xjj->{
                    if(xjj.isAnnotationPresent(MyAnnotation.class)){
                        MyAnnotation declaredAnnotation = xjj.getDeclaredAnnotation(MyAnnotation.class);
                        Arrays.stream(declaredAnnotation.value())
                                .forEach(xjb-> System.out.println(xjb));
                    }
                    try {
                        xjj.invoke(tt,"超哥",33);
                    } catch (IllegalAccessException e) {
                        e.printStackTrace();
                    } catch (InvocationTargetException e) {
                        e.printStackTrace();
                    }
                });

    }
}
